package com.activenetwork.smlite.testcase.events.createEvents.basics;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.activenetwork.custom.uielement.UIElement;
import com.activenetwork.custom.uielement.decorate.IdentifierFactory;
import com.activenetwork.schema.model.event.EventBasicType;
import com.activenetwork.smlite.page.event.EventDetailView.EventBasicSubview;
import com.activenetwork.smlite.snippet.EventsSnippet;
import com.activenetwork.smlite.testcase.BaseCase;
import com.activenetwork.util.EnvContext;
import com.activenetwork.util.verification.gson.FailurePoint;

public class Basics031 extends BaseCase {
	
	static final Logger logger = LoggerFactory.getLogger(Basics031.class);
	private EventBasicType.Tag tag;
	
	@BeforeClass(alwaysRun = true)
	public void dataSetup(){
		tag = new EventBasicType.Tag();
		tag.setTagName("Test tag description max length");
		tag.setTagDesc("Test tag description max length");
		tag.setPrivate(false);
	}
	
	@Test
	public void Verify_Tag_Name_maximum_length_is_25(){
		loginBusiness.login();
		
		EventBasicSubview eventBasicSubview = EventsSnippet.gotoAddEventPage();
		eventBasicSubview.setTag(tag);
		UIElement tagName = IdentifierFactory.createUIElement("EventBasicSubview", "tagName");
		String maxlen = tagName.getAttribute("maxlength");
		if(!StringUtils.equals(maxlen, "25")){
			EnvContext.failurePointTL.get().add(
					new FailurePoint(Basics031.class.getName(), 
					"Verify tag name max length is 25", 
					"Tag name max length is " + maxlen));
		}
		
		loginBusiness.logout();
	}

}
